import 'package:flutter/material.dart';

import './booklist/index.dart';

class BookList extends StatefulWidget {
  BookList({Key? key}) : super(key: key);

  @override
  State<BookList> createState() => _BookListState();
}

class _BookListState extends State<BookList> {
  List<Tab> bookTabItemList = [
    Tab(text: '最新发布'),
    Tab(text: '本周最热'),
    Tab(text: '最多收藏'),
    Tab(text: '小编推荐'),
  ];

  @override
  Widget build(BuildContext context) {
    Color color = Theme.of(context).backgroundColor;
    return DefaultTabController(
      length: bookTabItemList.length, 
      child: Scaffold(
        appBar: AppBar(
          elevation: 0.0,
          backgroundColor: Colors.white,
          title: TabBar(
            indicator: BoxDecoration(border: Border(
              bottom: BorderSide(color: color, width: 2.0)
            )),
            labelColor: color,
            unselectedLabelColor: Colors.black87,
            tabs: bookTabItemList,
          )
        ),
        body: TabBarView(
          children: [
            BookListWidget(),
            BookListWidget(),
            BookListWidget(),
            BookListWidget(),
          ],
        )
      ),
    );
  }
}
